import React, { useRef, useState } from 'react'
import PhysicalPartition from './PhysicalPartition'
import Management from './Management'
import AddPartitionModel from './AddPartitionModel'
const Partition = () => {
  const [isModalOpen, setIsModalOpen] = useState(false);
  const [AddType, setAddType] = useState("");

  const ManagementRef = useRef();

  const PhysicalPartitionRef = useRef();
  return (
    <>
      <div
        style={{
          width: '66%',
          height: '100%',
          display: 'grid',               // 开启 grid
          gridTemplateColumns: '1fr 1fr',// 两列，等宽
          gap: 24,                       // 行间距 & 列间距
        }}
      >
        {/* 第一行 */}
        <div><PhysicalPartition
          ref={PhysicalPartitionRef}
          setIsModalOpen={setIsModalOpen}
          setAddType={setAddType}/></div>
        <div><Management
          ref={ManagementRef}
          setIsModalOpen={setIsModalOpen}
          setAddType={setAddType}
         
        /></div>

        {/* 第二行 */}
        <div></div>
        <div></div>
      </div>
      <div></div>

      {isModalOpen && <AddPartitionModel
        AddType={AddType}
        setIsModalOpen={setIsModalOpen}
        isModalOpen={isModalOpen}
         Management_Update={ManagementRef.current.Management_GetData}
         Partition_Update={PhysicalPartitionRef.current.Partition_GetData}
      />}

    </>
  )
}

export default Partition